FreeBSD - configure network interface fxp0

chris (2006-05-02 16:15:53)
6929 views
0 replies
It's about 3 years since I last build a FreeBSD box, so it would be fair to say I'm no expert. Starting work with Yahoo! in a couple weeks time, it seemed like a good idea to get some familiarity with the platform of choice in my new employment. Yesterday I spend a couple of hours doing some 'housekeeping' exercises on Brezhnev at home, freeing up disk space and moving all project data and cvs over onto a spare disc (hdd), leaving hdb empty and hda ready for a reinstall (over the current built (slackware-10.something)

I did go through the network config process as part of the post-install stage, but on first boot the system didn't bring the network interface up. ifconfig quick shows a difference in the way freeBSD labels network interfaces. I spotted fxp0, which wuold probably be equivalent to eth0 on the old slackware system.

FreeBSD has a helpful carrier status on each interface under ifconfig, so when the cable is plugged in, the status changes from "no carrier" to "active" - this a quick an easy way of telling which NIC you've plugged into. The next step is to bring it up with a valid ethernet configuration. I found this to be as simple as:

$ ifconfig fxp0 192.168.1.45 netmask 255.255.255.0 up

However nothing was pingable at that stage, because no routes were defined. Whereas in linux you can type 'route -a' to print the entire route table, freeBSD's 'man route' doesn't offer such a feature, so I just did 'route flush' to remove any pre-defined static routes, and then started from scratch. I just had to point my system at the outside world. I'm not a network guru, but the following had things up and running in no time:

$ route add 0.0.0.0 192.168.1.1

This is simpler than the equivalent route add under linux - FreeBSD doesn't seem to want -gw as an option identifier, it just relies on the sequence of the parameters you provide to know what to set where.

Now I'm gonna find out how to get this config to persist and survive a reboot. Normally I'd be looking for /etc/rc.d/rc.inet1.conf... mumble mumble...

comment